<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="layuiadmin/style/admin.css" media="all">
  <style type="text/css">
			.demoTable {
				/*margin-top: 50px;*/
			}
			
			.container {
				margin-left: 30px !important;
				margin-right: 30px !important;
			}
			
			th,
			td {
				text-align: center !important;
			}
			
			.demoTable {
				margin-top: 20px;
				margin-bottom: 20px;
			}
			/*工具栏*/
			.layui-form input {
				height: 30px;
				line-height: 30px;
			}
			.halfw {
				width: 5%;
			}
			.addbtn{
				text-align: right;
			}
			/*//工具栏*/
			.fa-info-circle {
				color: #FFB800;
			}
			.fa-pencil {
				color: #69aa46;
			}
			.fa-trash-o {
				color: #FF5722;
			}
		</style>
	</head>

	<body>

		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-header">资源列表</div>
						<div class="layui-card-body">
							<div class="demoTable">
								<div class="layui-form">
									<div class="layui-row">
										<!--输入框-->
									</div>

								</div>
							</div>

							<table class="layui-hide" id="LAY_table_user" lay-filter="useruv"></table>	
						</div>
					</div>
				</div>
			</div>
		</div>
		<script type="text/html" id="indexTpl">
			{{d.LAY_TABLE_INDEX+1}}
		</script>
		<script src="layuiadmin/layui/layui.js"></script>  
  		<script>
  	      layui.config({
             base: 'layuiadmin/' //静态资源所在路径
 		 }).extend({
    				index: 'lib/index' //主入口模块
  		}).use(['jquery','table'], function() {
				var table = layui.table,
					 $ = layui.jquery;


              let key2 = localStorage.getItem(`key`);
              localStorage.removeItem(`key`);
              //方法级渲染
				table.render({
					elem: '#LAY_table_user',
					page: true,
					limits: [10, 20, 30],
					limit: 10,
					url: '/mxweb/res/pagelist?key='+encodeURI(encodeURI(key2)),
					request: {
						pageName: 'currentPage', // 当前页
						limitName: 'pageSize' // 每页面显示多少条
					},
					response: {
						statusName: 'code',
						statusCode: '1',
						msgName: 'msg',
						countName: 'total',
						dataName: 'data'
					},
					cols: [


						[ //表头
							{
                                type:'numbers',
                                title: '序号',
                                templet: '#indexTpl',
                                width: '10%'

                            }, {
								field: 'text',
								title: '名称'
							},{
								field: 'link',
								title: '链接'
							},  {
								field: 'psd',
								title: '密码',
								width: '10%'
							}
						]
					],
					id: 'testReload'
				});
				
				//
				var $ = layui.$,
					active = {
						nameSearch: function() {
							var name = $('input[name="name"]').val();
							table.reload("testReload", { //此处是上文提到的 初始化标识id
								where: {
									//key: { //设定异步数据接口的额外参数
									text: name
									//}
								}
							});
						}
					};
				$('.layui-btn').on('click', function() {
					var type = $(this).data('type');
					active[type] ? active[type].call(this) : '';
				});
			});
		</script>
	</body>

</html>